/***** init section, begin *****/
$(document).ready(
    function() {
        bindContextMenuEvents();
    }
);

function bindContextMenuEvents()
{
    $("#cMenu1").bind('click', function(e)
    {
        contextMenu1Click(e.currentTarget);
    });
}

function contextMenu1Click(obj)
{
//    wacDebugLog("C1: " + obj.id + " text:" + $("#" +obj.id + " div" ).attr("innerHTML"));

    if($("#floatingPanel").is(":visible")){
        $("#floatingPanel").hide();
        $("#" +obj.id + " div" ).attr("innerHTML", "显示库存查询");
    }
    else{
        $("#floatingPanel").css("z-index", $.maxZIndex()-10);
//        $("#floatingPanel").show("bounce", {}, 500, contextMenuloadStockInquiryPanel);
        $("#floatingPanel").show("bounce", {}, 500, function(){});
        $("#" +obj.id + " div" ).attr("innerHTML", "隐藏库存查询");
    }
}

//function contextMenuloadStockInquiryPanel()
//{
//    wacShowPortletLoading("#floatingPortlet .wacPortlet-content", "");
//    var params = {
//        "data_format" : 'json'
//    };
//
//    $.ajax({
//        url: BASE_URL + "factory/loadStockInquiryPanel",
//        global: true,
//        type: "GET",
//        data: params,
//        dataType: "json",
//        success: function(jsonData){
//            contextMenuLoadStockInquiryPanelCallback(jsonData);
//        },
//        error: function(XMLHttpRequest, textStatus, errorThrown){
//            wacDebugLog("contextMenuloadStockInquiryPanel Error: " + $(this).dump()); // the options for this ajax request
//        }
//    });
//}
//
//function contextMenuLoadStockInquiryPanelCallback(jsonData)
//{
////    $("#floatingPortlet .wacPortlet-content").attr("innerHTML", jsonData);
//    $("#floatingPortlet .wacPortlet-content").html(jsonData);
//    wacHideBlockUI("#floatingPortlet .wacPortlet-content");
//}

